#include <iostream>

using namespace std;

//打印移动过程
void move(char src, char dest)
{
    cout << src << " --> " << dest << endl;
}

//移动递归，以medium为中介将src上的盘子移动到dest处
void hanoi(int x, char src, char medium, char dest)
{
    if (x == 1)
        move(src,dest);
    else
    {
        hanoi(x-1, src, dest, medium);
        move(src, dest);
        hanoi(x-1, medium, src, dest);
    }
}

int main()
{
    int x;//盘子个数
    cout << "enter the number of plats :" ;
    cin >> x;
    cout << "the step of moving : " << x << endl;

    hanoi(x,'A','B','C');//调用hanoi函数

    return 0;
}
